<!DOCTYPE HTML>
<html>
	<head>
		<title>
			# block title
			# endblock
			| strategy games
		</title>
	</head>
	<body>
		<h1>Test</h1>
		<input type="button" value="Test" id="test"/>
		<script src="/js/jquery.js"></script>
		<script>
			function parseSafe(data) {
				return data && data != '' ? JSON.parse(data) : {};
			}
			$(document).ready(function(){
				$('#test').click(function(){
					$.post('save', { findBy: 'person-Dan', data: JSON.stringify({ name: 'Dan' }) }, function(savedWithKey){
						$.post('read', { key: savedWithKey.key }, function (o){
							var data = parseSafe(o.data);
							$('body').append(data.name);
						});
						
						$.post('find', { keyword: 'person' }, function (o){
							for (i in o){
								var data = parseSafe(o[i].data);
								$('body').append(data.name);
							}
						});
					});
				});
			});
		</script>
	</body>
</html>
